package com.ymttest.database.sqlwapper;

import java.math.BigDecimal;
import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.YmtCouponValue;
import com.ymttest.utils.EnvSetup;

public class YmtCouponValueWapper {
	SqlManager manager;

	public YmtCouponValueWapper() {
		manager = new SqlManager("ymt" + EnvSetup.getEnv());
	}

	/**
	 * 
	 * @param CouponValue
	 *            优惠券金额
	 * @param MinorderValue
	 *            订单最小可用金额
	 * @param CouponSettingId
	 *            优惠券规则ID
	 */
	public void insertCouponValueWapper(double CouponValue, double MinorderValue, int CouponSettingId) {
		YmtCouponValue record = new YmtCouponValue();
		BigDecimal fcouponvalue = new BigDecimal(CouponValue);
		record.setFcouponvalue(fcouponvalue);
		BigDecimal fminordervalue = new BigDecimal(MinorderValue);
		record.setFminordervalue(fminordervalue);
		record.setIcouponsettingid(CouponSettingId);
		int i = manager.insert("com.ymttest.database.mapping.YmtCouponValueMapper.insertSelective", record);
		manager.commit();
	}
	
	public List<YmtCouponValue> selectByiCouponSettingId(int iCouponSettingId) {
		List<YmtCouponValue> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.YmtCouponValueMapper.selectByiCouponSettingId",
						iCouponSettingId);
		return result;
	}

}
